/***************************************************************************
 *   Copyright (C) 2010 by programmeboy                                    *
 *   programmeboy@gmail.com                                                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.                                        *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
 ***************************************************************************/

#include "print.h"

void init_video_mode()
{
	__asm
	{
		// Text mode 80x25
		mov ax, 3
		int 0x10
		
		// Page 0
		mov ax, 0x500
		int 0x10
	}
}


void clear_screen()
{
	__asm
	{
		//
		// White text on black
		//
		
		mov bh, 7
		xor cx, cx
		mov dx, 0x184f
		mov ax, 0x600
		int 0x10
		
		//
		// Cursor at 0,0
		//
		
		xor bh, bh
		xor dx, dx
		mov ah, 2
		int 0x10
	}
}

void print_char (char c)
{
	__asm
	{
		mov bx, 0002h
		mov al, c
		mov ah, 0xe
		int 0x10
	}
}

void print_string (const char *str)
{
	char c;
	while (c = *str++)
	{
		print_char(c);
	}
}